<template>
    <div>
        <el-tooltip class="item" effect="dark" content="去购物车" placement="left">
            <div id="toCart" @click="toCart"><i class="el-icon-shopping-cart-2"></i> </div>
        </el-tooltip>
        <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
            <nav>
                <el-menu-item>
                    <img src="../../public/images/logo.png" alt="" class="logo">
                </el-menu-item>
                <el-menu-item>
                    <router-link to="/index">首页</router-link>
                </el-menu-item>
                <el-menu-item>
                    <router-link to="/index/pShow">商品</router-link>
                </el-menu-item>
                <el-menu-item>
                    <router-link to="/index/personal/selfinfo">个人中心</router-link>
                </el-menu-item>
                <el-menu-item>
                    <router-link to="/index/about">关于</router-link>
                </el-menu-item>
                <!-- <el-menu-item>
                    <router-link to="/index/loop">loop</router-link>
                </el-menu-item> -->
                <el-menu-item>
                    <div v-if="show == true" id="navRight">
                        <el-menu-item class="subNavRight">
                            <router-link to="/login">登录</router-link>
                        </el-menu-item>
                        <el-menu-item class="subNavRight">
                            <router-link to="/register">注册</router-link>
                        </el-menu-item>
                    </div>
                    <div v-else>
                        <img :src=user.user_pic alt="" class="img">
                        <span class="userName">{{ user.user_name }}</span>&nbsp;
                        <span class="loginOut" @click="layout">退出</span>
                    </div>
                </el-menu-item>
            </nav>
        </el-menu>
        <router-view></router-view>
    </div>
</template>

<script src="../assets/js/IndexView.js"></script>
<style src="../assets/css/IndexView.css" scoped></style>